package com.ibm.workplace.wcm.cqplugin.cq;

import java.util.*;

import com.ibm.workplace.wcm.cqplugin.*;



public class CqConnectionProfile implements IConnectionProfile {
    
    private String name;
    private String family;
    private String host;
    private String port;
    private String userName;
    private String password;
    private String schema; //added by Kevin
    
   // private Hashtable columnNameMappings;
    
    public static final String TYPE_CMVC = "cmvc";
    
    public CqConnectionProfile() {
        this("", "", "", "", "", "", "");
    }
    
    public CqConnectionProfile(String name, String family, String host, String port, String userName, String password, String schema) {
        super();
        
        this.name = name;
        this.family = family;
        this.host = host;
        this.port = port;
        this.userName = userName;
        this.password = password;
        this.schema = schema;
        
     //   this.columnNameMappings = new Hashtable();
    }
    
    public String getFamily() {
        return family;
    }
    
    public void setFamily(String family) {
        this.family = family;
    }
    
    public String getHost() {
        return host;
    }
    
    public void setHost(String host) {
        this.host = host;
    }
    
    public String getPassword() {
        return password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
    
    public String getPort() {
        return port;
    }
    
    public void setPort(String port) {
        this.port = port;
    }
    
    public String getUserName() {
        return userName;
    }
    
    public void setUserName(String userName) {
        this.userName = userName;
    }
    
    public String getName() {
        return name;
    }

    
    public void setName(String name) {
        this.name = name;
    }

    public void setSchema(String schema) {
        this.schema = schema;
    }

    public String getSchema() {
        return schema;
    }
    
    public String getType() {
        return TYPE_CMVC;
    }
    
    public boolean equals(Object o) {
        return (o != null && o instanceof CqConnectionProfile && ((CqConnectionProfile)o).getName().equals(getName()));
    }
    
    public int hashCode() {
       return genHashCode(getName()) + genHashCode(getFamily()) + genHashCode(getHost()) + genHashCode(getPort()) + genHashCode(getUserName()) +  genHashCode(getPassword());
    }
    
    private int genHashCode(String str) {
        if (str == null) {
            return 0;
        } else {
            return str.hashCode();
        }
    }
    
    /*public Hashtable getColumnNameMappings() {
        return columnNameMappings;
    }
    
    public void setColumnNameMappings(Hashtable columnNameMappings) {
        this.columnNameMappings = columnNameMappings;
    }
    */
}
